package com.pactera.integral.dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.pactera.integral.common.repository.GenericRepository;
import com.pactera.integral.entity.UserPerformanceScore;

@Repository("userPerformanceScoreDao")
public interface UserPerformanceScoreDao extends GenericRepository<UserPerformanceScore, String> {

	UserPerformanceScore findById(String id);
	
	@Query(value="select sum(iups.tl_score) as score from INT_USER_PERFORMANCE_SCORE iups where iups.user_id = :userId and iups.year = :year and iups.month =:month", nativeQuery = true)
	Integer findByDetail(@Param("userId") String userId, @Param("year") int year, @Param("month") int month);

}